package com.xzy.ec.entity;

import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 
 * </p>
 *
 * @author jobob
 * @since 2022-06-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class OmsOrder implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 订单id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 商品id
     */
    private Integer goodsId;

    /**
     * 收货地址id
     */
    private Integer deliveryAddrId;

    /**
     * 商品名称——冗余以减少连表
     */
    private String goodsName;

    /**
     * 商品数量
     */
    private Integer goodsCount;

    /**
     * 商品单价
     */
    private BigDecimal goodsPrice;

    /**
     * 订单支付金额
     */
    private BigDecimal orderAmountTatal;

    /**
     * 下单渠道 1.pc 2.android 3.iso
     */
    private Integer orderChannel;

    /**
     * 订单状态 0新建未支付 1.已支付 2.已发货 3.已收货 4.已退款 5.已完成
     */
    private Integer status;

    /**
     * 支付时间
     */
    @TableField("Pay_date")
    private LocalDateTime payDate;

    /**
     * 逻辑删除
     */
    private Integer isDeleted;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    public OmsOrder orderVOtoOmsOrder(OrderVO o){
        this.userId=o.getUserId();
        this.goodsId=o.getGoodsId();
        this.goodsName=o.getGoodsName();
        this.goodsCount=o.getGoodsCount();
        this.orderAmountTatal=o.getOrderAmountTatal();
        this.orderChannel=o.getOrderChannel();
        return this;
    }
}
